<#import "/common/taglibs/spring.ftl" as spring/>
<#macro messageView message collapse="">
<div class="panel panel-default">
    <div class="panel-heading">
        <h4 class="panel-title">
            <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse_${(message.id)!}"> 
            ${(message.title)!} 
            <span class="pull-right">
                <@showUser users=users userId=(message.senderId)!/>
                &nbsp;&nbsp;&nbsp;
                <@dateTime date=message.sendDate />
            </span>
            </a>
        </h4>
    </div>
    <div id="collapse_${(message.id)!}" class="panel-collapse collapse ${collapse!}">
        <div class="panel-body">
            ${message.content!}
            <div style="padding-top: 20px;">
                <#if message.senderId != user.id>
                    <a class="btn btn-circle blue btn-outline" href="${ctx}/personal/message/${message.id}/reply"><@spring.message code="op.reply" /></a>
                    <a class="btn btn-circle blue btn-outline" href="${ctx}/personal/message/${message.id}/forward"><@spring.message code="op.forward" /></a>
                </#if>
                    <a class="btn btn-circle blue btn-outline btn-view-store" data-href="${ctx}/personal/message/batch/store?ids=${message.id}"><@spring.message code="op.save.store" /></a>
                <#if ((message.senderId == user.id) & (message.senderState != 'trash_box')) | ((message.receiverId == user.id) & (message.receiverState != 'trash_box')) >
                    <a class="btn btn-circle red btn-outline btn-view-recycle" data-href="${ctx}/personal/message/batch/recycle?ids=${message.id}"><@spring.message code="button.delete" /></a>
                </#if>
            
                <#if ((message.senderId == user.id) & (message.senderState == 'trash_box')) | ((message.receiverId == user.id) & (message.receiverState ==  'trash_box')) >
                        <a class="btn btn-circle red btn-outline btn-view-delete" data-href="${ctx}/personal/message/batch/delete?ids=${message.id}"><@spring.message code="button.delete" /></a>
                </#if>
            </div>
        </div>
    </div>
</div>
</#macro>